package com.tiancheng.trade.order.mapper;

import com.tiancheng.trade.order.model.QrOrder;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

/**
 * 二维码订单持久化接口
 *
 * @author likailun
 * @date 2021-09-03
 */
@Repository
public interface QrOrderMapper extends TYBaseMapper<QrOrder> {

    /**
     * 订单退款次数
     * @param orderId 订单号
     * @param refundAmount 退款金额
     * @return
     */
    @Update("update qr_order set refund_amount = refund_amount + #{refundAmount},error_trade=#{tradeStatus} where order_id = #{orderId}")
    int setRefundAndTradeStatus(@Param("orderId") String orderId, @Param("refundAmount") int refundAmount, @Param("tradeStatus")int tradeStatus);

}